import React, { Suspense } from "react";
import { BrowserRouter, useRoutes } from "react-router-dom";
const List1 = React.lazy(() => import("../views/list1"));
const List2 = React.lazy(() => import("../views/list2"));

const routes = [
  {
    path: "/",
    element: <List1></List1>,
  },
  {
    path: "/list2",
    element: <List2></List2>,
  },
];
const RouterView = () => useRoutes(routes);
const Router = () => {
  return (
    <BrowserRouter>
      <Suspense fallback="路由加载中...">
        <RouterView></RouterView>
      </Suspense>
    </BrowserRouter>
  );
};

export default Router;
